home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DOS.SWG / 0016_Get the program Name.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-18  |  1KB  |  44 lines

  1. { Gets the program name.
  2.   Part of the Heartware Toolkit v2.00 (HTfile.PAS) for Turbo Pascal.
  3.   Author: Jose Almeida. P.O.Box 4185. 1504 Lisboa Codex. Portugal.
  4.           I can also be reached at RIME network, site ->TIB or #5314.
  5.   Feel completely free to use this source code in any way you want, and, if
  6.   you do, please don't forget to mention my name, and, give me and Swag the
  7.   proper credits. }
  8.  
  9. FUNCTION Get_Prg_Name : String8;
  10.  
  11. { DESCRIPTION:
  12.     Gets the program name.
  13.   SAMPLE CALL:
  14.     St := Get_Prg_Name;
  15.   RETURNS:
  16.     The program name, e.g., '12345678'
  17.                       or    '$$$$$$$$' if not available.
  18.   NOTES:
  19.     This function excludes the .EXE extension of the program. }
  20.  
  21. var
  22.   St    : string;
  23.   F     : byte;
  24.   Found : boolean;
  25.  
  26. BEGIN { Get_Prg_Name }
  27.   St := ParamStr(0);
  28.   Found := No;
  29.   F := Length(St);
  30.   while (F > 0) and (not Found) do
  31.     begin
  32.       if St[F] = '\' then
  33.         Found := Yes
  34.       else
  35.         Dec(F);
  36.     end;
  37.   St := Copy(St,Succ(F),255);
  38.   F:= Pos('.',St);
  39.   Delete(St,F,255);
  40.   if St = '' then
  41.     St := '$$$$$$$$';
  42.   Get_Prg_Name := St;
  43. END; { Get_Prg_Name }
  44.